.class final Lcom/brixd/niceapp/service/UserService$2;
.super Ljava/lang/Object;
.source "UserService.java"

# interfaces
.implements Lretrofit/Callback;


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/brixd/niceapp/service/UserService;->checkMessages(Lcom/brixd/niceapp/model/UserModel;)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x8
    name = null
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Ljava/lang/Object;",
        "Lretrofit/Callback",
        "<",
        "Lorg/json/JSONObject;",
        ">;"
    }
.end annotation


# instance fields
.field final synthetic val$userModel:Lcom/brixd/niceapp/model/UserModel;


# direct methods
.method constructor <init>(Lcom/brixd/niceapp/model/UserModel;)V
    .registers 2

    .prologue
    .line 329
    iput-object p1, p0, Lcom/brixd/niceapp/service/UserService$2;->val$userModel:Lcom/brixd/niceapp/model/UserModel;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public failure(Lretrofit/RetrofitError;)V
    .registers 4
    .param p1, "error"    # Lretrofit/RetrofitError;

    .prologue
    .line 342
    const-string v0, "Check message fail"

    invoke-static {v0}, Lcom/zuiapps/suite/utils/log/LogUtil;->e(Ljava/lang/String;)V

    .line 343
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "/"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {p1}, Lretrofit/RetrofitError;->getMessage()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lcom/zuiapps/suite/utils/log/LogUtil;->e(Ljava/lang/String;)V

    .line 344
    return-void
.end method

.method public bridge synthetic success(Ljava/lang/Object;Lretrofit/client/Response;)V
    .registers 3

    .prologue
    .line 329
    check-cast p1, Lorg/json/JSONObject;

    invoke-virtual {p0, p1, p2}, Lcom/brixd/niceapp/service/UserService$2;->success(Lorg/json/JSONObject;Lretrofit/client/Response;)V

    return-void
.end method

.method public success(Lorg/json/JSONObject;Lretrofit/client/Response;)V
    .registers 7
    .param p1, "jsonData"    # Lorg/json/JSONObject;
    .param p2, "response"    # Lretrofit/client/Response;

    .prologue
    .line 333
    const-string v1, "message"

    invoke-virtual {p1, v1}, Lorg/json/JSONObject;->optJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;

    move-result-object v0

    .line 334
    .local v0, "messageJson":Lorg/json/JSONObject;
    iget-object v1, p0, Lcom/brixd/niceapp/service/UserService$2;->val$userModel:Lcom/brixd/niceapp/model/UserModel;

    invoke-virtual {v1}, Lcom/brixd/niceapp/model/UserModel;->getUid()I

    move-result v1

    const-string v2, "last_check_time"

    invoke-virtual {v0, v2}, Lorg/json/JSONObject;->optLong(Ljava/lang/String;)J

    move-result-wide v2

    invoke-static {v1, v2, v3}, Lcom/brixd/niceapp/util/LocalCacheUtils;->setMessageLastCheckTime(IJ)V

    .line 335
    iget-object v1, p0, Lcom/brixd/niceapp/service/UserService$2;->val$userModel:Lcom/brixd/niceapp/model/UserModel;

    invoke-virtual {v1}, Lcom/brixd/niceapp/model/UserModel;->getUid()I

    move-result v1

    const-string v2, "messages"

    invoke-virtual {v0, v2}, Lorg/json/JSONObject;->optJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v2

    invoke-static {v1, v2}, Lcom/brixd/niceapp/util/LocalCacheUtils;->setMessages(ILorg/json/JSONArray;)V

    .line 337
    invoke-static {}, Lcom/brixd/niceapp/bus/BusProvider;->getInstance()Lcom/squareup/otto/Bus;

    move-result-object v1

    new-instance v2, Lcom/brixd/niceapp/bus/event/MessageNotifyEvent;

    iget-object v3, p0, Lcom/brixd/niceapp/service/UserService$2;->val$userModel:Lcom/brixd/niceapp/model/UserModel;

    invoke-virtual {v3}, Lcom/brixd/niceapp/model/UserModel;->getUid()I

    move-result v3

    invoke-static {v3}, Lcom/brixd/niceapp/util/LocalCacheUtils;->getMessageCount(I)I

    move-result v3

    invoke-direct {v2, v3}, Lcom/brixd/niceapp/bus/event/MessageNotifyEvent;-><init>(I)V

    invoke-virtual {v1, v2}, Lcom/squareup/otto/Bus;->post(Ljava/lang/Object;)V

    .line 338
    return-void
.end method
